From: Luca Bacci Date: Thu, 1 Dec 2022 17:18:23 +0000 (+0100) Subject: GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~9^2~57^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=f788e994;p=gtk4.git GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue Reference: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7808 Fixes #4499, #5387, #5170 --- diff --git a/gdk/x11/gdkglcontext-glx.c b/gdk/x11/gdkglcontext-glx.c index 229fe4afaf..6be6eb7e16 100644 --- a/gdk/x11/gdkglcontext-glx.c +++ b/gdk/x11/gdkglcontext-glx.c @@ -232,6 +232,12 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context, "Making GLX context %p current to drawable %lu", context, (unsigned long) drawable); + /* Work around a glitch, see + * https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5281 + */ + if (glXGetCurrentContext () != self->glx_context) + glXMakeContextCurrent (dpy, None, None, NULL); + if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context)) return FALSE;